import React,{Component} from 'react'

import {Row,Col,Menu,Spin,Table,Input} from 'antd'

class EditableCell extends React.Component {
    state = {
      value: this.props.value
    }
    handleChange = (e) => {
      const value = e.target.value;
      
      this.setState({ value });
      if (this.props.onChange) {
        this.props.onChange(value);
      }
    }
    check = () => {
      if (this.props.onChange) {
        this.props.onChange(this.state.value);
      }
    }
    edit = () => {
      this.setState({ editable: true });
    }
    render() {
      const { value } = this.state;
      return (
        <div className="editable-cell">
            <div className="editable-cell-input-wrapper">
            <Input
                value={value}
                onChange={this.handleChange}
                onPressEnter={this.check}
            />
            </div>
        </div>
      );
    }
  }

  export default EditableCell